<?php
//use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBlogArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('blog_articles', function (Blueprint $table) {
			$table->comment = '文章管理表';
            $table->increments('id')->comment('文章管理ID');
			$table->string('title')->default('')->comment('文章标题');
			$table->string('description')->default('')->comment('文章描述');
			$table->string('keywords')->default('')->comment('文章关键词');
			$table->text('content')->comment('文章内容');
			$table->integer('image_id')->nullable()->comment('图片id');
			$table->tinyInteger('status')->default(1)->comment('状态:0=禁用,1=启用');
			$table->tinyInteger('open')->default(0)->comment('是否推荐:0=否,1=是');
			$table->integer('sort')->default(1)->comment('排序');
			$table->integer('blog_column_id')->comment('所属栏目');
			$table->integer('pv')->default(0)->comment('浏览量');
			$table->integer('like')->default(0)->comment('点赞量');
            $table->timestamps();
        });
		Schema::create("blog_article_labels", function(Blueprint $table){
			$table->comment = '文章标签关联表';
            $table->increments('id');
            $table->integer("blog_article_id")->comment('文章ID');
            $table->integer("blog_label_id")->comment('标签ID');
        });
		Schema::create("blog_comments", function(Blueprint $table){
			$table->comment = '文章评论表';
            $table->increments('id')->comment('文章评论ID');
			$table->integer("blog_article_id")->comment('文章ID');
			$table->string('content')->default('')->comment('评论内容');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('blog_articles');
        Schema::dropIfExists('blog_article_labels');
        Schema::dropIfExists('blog_comments');
    }
}
